/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.esink.tests;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 *
 * @author Thyago
 */
public class ContextMenu {

    public static void apply() throws IOException {

        FileWriter file = new FileWriter(new File("C:\\Users\\Thyago\\Desktop\\eSink\\"
                + "Desenvolvimento\\eSink-PC\\src\\br\\com\\esink\\resources\\files\\applyinContextMenu.reg"));
        
        file.write("Windows Registry Editor Version 5.00" + System.lineSeparator() + System.lineSeparator());
        file.write("[HKEY_CLASSES_ROOT\\Directory\\Background\\shell\\Calculadora\\command]" + System.lineSeparator()
                + System.lineSeparator());
        file.write("@=\"C:\\\\Windows\\\\system32\\\\calc.exe\"" + System.lineSeparator()
                + System.lineSeparator());
        file.write("[HKEY_CLASSES_ROOT\\Directory\\shell\\Calculadora\\command]" + System.lineSeparator()
                + System.lineSeparator());
        file.write("@=\"C:\\\\Windows\\\\system32\\\\calc.exe\"" + System.lineSeparator()
                + System.lineSeparator());
        file.write("[HKEY_CLASSES_ROOT\\Folder\\shell\\Calculadora\\command]" + System.lineSeparator()
                + System.lineSeparator());
        file.write("@=\"C:\\\\Windows\\\\system32\\\\calc.exe\"" + System.lineSeparator()
                + System.lineSeparator());
        file.write("[HKEY_CLASSES_ROOT\\Drive\\shell\\Calculadora\\command]" + System.lineSeparator()
                + System.lineSeparator());
        file.write("@=\"C:\\\\Windows\\\\system32\\\\calc.exe\"" + System.lineSeparator()
                + System.lineSeparator());
        file.close();

        System.out.println("Arquivo para adicionar menu de contexto criado!");
    }

    public static void remove() throws IOException {

        FileWriter file = new FileWriter(new File("C:\\Users\\Thyago\\Desktop\\eSink\\"
                + "Desenvolvimento\\eSink-PC\\src\\br\\com\\esink\\resources\\files\\removeContextMenu.reg"));
        
        file.write("Windows Registry Editor Version 5.00" + System.lineSeparator() + System.lineSeparator());
        file.write("[-HKEY_CLASSES_ROOT\\Directory\\Background\\shell\\Calculadora]" + System.lineSeparator()
                + System.lineSeparator());
        file.write("[-HKEY_CLASSES_ROOT\\Directory\\shell\\Calculadora\\command]" + System.lineSeparator()
                + System.lineSeparator());
        file.write("[-HKEY_CLASSES_ROOT\\Folder\\shell\\Calculadora\\command]" + System.lineSeparator()
                + System.lineSeparator());
        file.write("[-HKEY_CLASSES_ROOT\\Drive\\shell\\Calculadora\\command]" + System.lineSeparator()
                + System.lineSeparator());
        file.close();

        System.out.println("Arquivo para excluir menu de contexto criado!");
    }

    public static void main(String[] args) throws IOException {
        apply();
        remove();
    }
}
